package com.yinzifan.manager.error;

import java.util.List;

import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController;
import org.springframework.boot.autoconfigure.web.servlet.error.ErrorViewResolver;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ErrorConfiguration{
	@Bean
	public BasicErrorController basicErrorController(ErrorAttributes errorAttributes,ServerProperties serverProperties,ObjectProvider<List<ErrorViewResolver>> errorViewResolversProvider) {
		return new MyErrorController(errorAttributes, serverProperties.getError(),
				errorViewResolversProvider.getIfAvailable());
	}
}
